package vip.geeker.iotms.help;


import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = false)
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = -4437174557851420046L;

    private int code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(BusinessResponseCode businessResponseCode) {
        super(businessResponseCode.getTip());
        this.code = businessResponseCode.getCode();
    }

    public BusinessException(BusinessResponseCode businessResponseCode, String extraMessage) {
        super(businessResponseCode.getTip().concat(extraMessage));
        this.code = businessResponseCode.getCode();
    }

}
